home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-09-28 | 5.0 KB | 164 lines |
- '***************************
- '* AMOS Professional *
- '* *
- '* AMAL_3 * Amal Functions
- '* *
- '* (c) Europress Software *
- '* *
- '* Ronnie Simpson *
- '***************************
- '
- '-------------------------------------------
- ' =XM =YM
- '-------------------------------------------
- 'Functions for returning the position of the mouse pointer in hardware
- 'coordinates.
- '
- 'eg. Let R0=XM Let Y=YM
- '
- '-------------------------------------------
- ' =K1 =K2
- '-------------------------------------------
- 'Functions for returning the status of the mouse keys, K1 for left key and
- 'K2 for the right.
- 'Functions returns -1 (true) if the button has been pressed otherwise they
- 'return 0 (false)
- '
- 'eg. If K1 Jump Lable Let R0=K1
- '
- '-------------------------------------------
- ' =J0 =J1
- '-------------------------------------------
- 'Functions for returning the status of the joysticks, J1 for left joystick
- 'and J0 for the right.
- 'Functions returns a bit pattern. (see AMOS Professional Joy instruction)
- 'The format of the bit pattern is as follows:-
- '
- ' Bit 0 set Joystick held up
- ' Bit 1 set Joystick held down
- ' Bit 2 set Joystick held left
- ' Bit 3 set Joystick held right
- ' Bit 4 set fire button pressed
- '
- 'eg. If J0=16 Jump Quit Let R0=J1
- '
- '-------------------------------------------
- ' =Z
- '-------------------------------------------
- 'Function for returning a random number,if used without a parameter Z will
- 'produce a random number in the range of -32767 to 32768, This can be limited
- 'to a set range by placing the required range number in brackets after the
- 'instruction.
- '
- 'eg. Let R0=Z(100) (random number in the range 0-100)
- ' Let RA=Z(5)+1 (random number in the range 1-6)
- '
- '
- '-------------------------------------------
- ' =XH =YH
- '-------------------------------------------
- 'Function for converting screen to hardware coordinates relative to the given
- 'screen number.
- ' +--->screen number
- ' | +--->coordinate to be converted
- ' Let X=XH(0,160)
- '
- ' Let RY=YH(1,100)
- '
- '-------------------------------------------
- ' =XS =YS
- '-------------------------------------------
- 'Function for converting hardware to screen coordinates relative to the given
- 'screen number.
- ' +--->screen number
- ' | +--->coordinate to be converted
- ' Let X=XS(0,300)
- '
- ' Let RY=YS(1,148)
- '
- '-------------------------------------------
- ' =V
- '-------------------------------------------
- 'Function to return intensity of the given sound channel, value returned
- 'will be in the range of 0 to 255 allowing animation in time with music etc.
- '
- ' +--->sound channel number to be tested
- ' Let RV=V(2)
- '
- ' Let Y=V(1)
- '
- '-------------------------------------------
- 'EXAMPLE
- '-------------------------------------------
- '
- Screen Open 0,320,200,4,Lowres : Flash Off
- Palette $339,$0,$F00,$FF0 : Curs Off : Cls 0 : Hide
- For N=0 To 3 : For C=0 To 3 : Colour N*4+C+16, Colour(C) : Next : Next
- '
- Rem *** define amal program for alien balls
- '
- A$=A$+"Let R0=RA; Let R1=RB"
- A$=A$+"Start:Let X=X+R0;Let Y=Y+R1"
- A$=A$+"If X>413 Jump A;"
- A$=A$+"If Y>215 Jump B;"
- A$=A$+"If X<150 Jump A;"
- A$=A$+"If Y<71 Jump B;"
- A$=A$+"Pause Jump Start"
- A$=A$+"A: If R0>0 Jump C; Let R0=RA; Let X=150; Pause Jump Start"
- A$=A$+"C: Let R0=RB; Let X=413; Pause Jump Start"
- A$=A$+"B: If R1>0 Jump D; Let R1=RA; Let Y=71; Pause Jump Start"
- A$=A$+"D: Let R1=RB; Let Y=215; Pause Jump Start"
- '
- Rem *** amal program for player ball
- '
- B$="Loop: Let X=XM;Let Y=YM;Pause Jump Loop"
- '
- Rem *** get a couple of sprite images
- '
- Ink 1 : Circle 10,10,7 : Ink 2 : Paint 10,10 : Get Sprite 1,3,3 To 18,18
- Ink 3 : Paint 10,10 : Get Sprite 2,3,3 To 18,18
- Cls 0 : Ink 3 : Box 20,20 To 300,180
- Make Mask
- '
- Rem *** set the external amal registers RA and RB
- '
- SPEED=1 : Amreg(0)=SPEED : Amreg(1)=-SPEED
- '
- Rem *** assign computed sprites to amal channels 8-14 (alien balls)
- '
- For N=8 To 14
- Sprite N,Rnd(260)+160,Rnd(140)+70,1 : Amal N,A$
- Next
- '
- Rem *** assign computed sprite 15 to amal channels (player ball)
- '
- Sprite 15,X Mouse,Y Mouse,2
- Limit Mouse 150,71 To 413,215
- Amal 15,B$
- '
- Rem *** start player movement and print out screen
- '
- Amal On 15
- Pen 3 : Paper 0 : Locate 0,1 : Centre "Avoid the red balls"
- Pen 2 : Locate 0,12 : Centre "G E T R E A D Y" : Wait 150 : Locate 10,12 : Cline(20)
- Pen 2 : Locate 17,23 : Print "SPEED=";SPEED
- Timer=0
- '
- Rem *** start aliens moving and loop basic part
- '
- Amal On
- Do
- If Sprite Col(15)
- Boom : Pen 3 : Locate 0,11 : Centre "G A M E O V E R"
- T=((SPEED-1)*800+Timer)/50
- Pen 2 : Locate 0,13 : Centre "You lasted"+Str$(T)+" Seconds"
- Direct
- End If
- If Timer>800
- Timer=0 : Inc SPEED
- Amreg(0)=SPEED : Amreg(1)=-SPEED
- Locate 23,23 : Print SPEED
- End If
- Loop
- '
- Direct